<template>
	<section>
		<!--工具条-->
		<el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
			<el-form :inline="true" :model="query">
				<el-form-item>
					<el-input v-model="query.keyword" placeholder="权限名称"></el-input>
				</el-form-item>
				<el-form-item>
					<el-button type="primary" v-on:click="queryData">查询</el-button>
				</el-form-item>
			</el-form>
		</el-col>

		<!--列表-->
		<el-table :data="pageInfo.data" highlight-current-row v-loading="listLoading" @selection-change="selsChange" style="width: 100%;">
			<el-table-column type="selection" width="55">
			</el-table-column>
			<el-table-column type="index" label="序号" width="100">
			</el-table-column>
			<el-table-column prop="name" label="权限名称" width="180" sortable>
			</el-table-column>
			<el-table-column prop="descs" label="描述" width="300" sortable>
			</el-table-column>
			<el-table-column prop="url" label="请求地址" width="180" sortable>
			</el-table-column>
			<el-table-column prop="sn" label="sn" width="180" sortable>
			</el-table-column>
			<el-table-column prop="parent.name" label="上级权限" min-width="180" sortable>
			</el-table-column>
		</el-table>

		<!--工具条-->
		<el-col :span="24" class="toolbar">
			<el-pagination layout="prev, pager, next" @current-change="handleCurrentChange" :page-size="query.pageSize" :total="pageInfo.total" style="float:right;">
			</el-pagination>
		</el-col>

	</section>
</template>

<script>

	export default {
		data() {
			return {
				//分页显示的数据
				pageInfo:{
					total:0,
					data:[]
				},
				//分页查找的参数
				query:{
					keyword:'',
					pageSize: 5,
					currentPage:1
				},
				listLoading: false,
				sels: []//列表选中列
				
			}
		},
		methods: {
			//分页工具栏事件
			handleCurrentChange(val) {
				//当前页
				this.query.currentPage = val;
				this.queryData();
			},
			//分页高级查询搜索方法
			queryData(){
				this.$http.post("/permission",this.query)
					.then(res=>{
						res = res.data
						this.pageInfo = res.data;
						this.query.currentPage = 1;

					}).catch(() => {

					});
			},

			selsChange: function (sels) {
				this.sels = sels;
			}
		},
		mounted() {
			this.queryData();
		}
	}

</script>

<style scoped>

</style>